package com.xm.servlet.background.commodity;


import com.xm.service.background.CommodityGiftsService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author 康文程
 * @date 2024-1-16
 */
@WebServlet("/background/update/commodity/gifts/inventory")
public class UpdateCommodityGiftsInventoryServlet extends HttpServlet {
    private final CommodityGiftsService service = new CommodityGiftsService();

    @SneakyThrows
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
        String commodityGiftsId = req.getParameter("commodityGiftsId");
        String giftsNumber = req.getParameter("giftsNumber");
        System.out.println(commodityGiftsId);
        System.out.println(giftsNumber);
        resp.getWriter().println(service.updateGiftsNumberById(Integer.parseInt(commodityGiftsId),Integer.parseInt(giftsNumber)));
    }
}
